<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';

$db = new DB('news');

$category_id = 1;

$pageSize = 10;//每页显示条数
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
if( $page < 1 ){
	$page = 1;
}

$total_sql = 'select id from relative_news where is_del=1';
$total = $db->query($total_sql)->getCount();

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/news/news_relative.php');

$sql = 'select id,title,url,orders from relative_news where is_del=1 order by orders desc, created desc limit '.(($page-1)*$pageSize).','.$pageSize;
$news_relative = $db->query($sql)->getAll();

//记录动作日志
Log::logs_articles(-2, 1);

//包含模板
require template('admin/news/news_relative');